package com.nbsaas.boot.shop.rest.convert;

import com.nbsaas.boot.shop.data.entity.ShopOauthToken;
import com.nbsaas.boot.shop.api.domain.simple.ShopOauthTokenSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class ShopOauthTokenSimpleConvert implements Converter<ShopOauthTokenSimple, ShopOauthToken> {




@Override
public ShopOauthTokenSimple convert(ShopOauthToken source) {
    ShopOauthTokenSimple result = new ShopOauthTokenSimple();

                result.setUnionId(source.getUnionId());

               try {
                   if(source.getShop()!=null){
                       result.setShop(source.getShop().getId());
                   }
                } catch (Exception ignored) { }

                result.setOpenId(source.getOpenId());
                result.setCustomerId(source.getCustomerId());

                try {
                    if(source.getShop()!=null){
                        result.setShopName(source.getShop().getName());
                    }
                } catch (Exception ignored) { }

                result.setId(source.getId());
                result.setAccessToken(source.getAccessToken());
                result.setTokenType(source.getTokenType());
                result.setExpiresTime(source.getExpiresTime());
                result.setRefreshToken(source.getRefreshToken());
                result.setLoginSize(source.getLoginSize());


    return result;
}

}